﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DotSpatial.Topology;
using System.Drawing;


namespace FXnaGis
{
    [Serializable]
    public class FTextShape:FShape
    {

        public FTextShape(string id):base(id)
        {

           

 

        }



        string _text;

        public string Text
        {
            get { return _text; }
            set { _text = value; }
        }


        Coordinate _postion;

        public Coordinate Postion
        {
            get { return _postion; }
            set { _postion = value; }
        }


        double _height;

        public double Height
        {
            get { return _height; }
            set { _height = value; }
        }

      


        public override void Draw(FMapArgs args)
        {

            double fontSize = args.ProjToPixel(this._height);



            if (fontSize < 1)
            {
                return;

            }


            //会有发虚的现象，之后再考虑为什么把

            int fsize =(int) Math.Ceiling(fontSize);

            Font _font = new Font("宋体", fsize);


         

            System.Drawing.Point pt=args.ProjToPixel(this._postion);

            args.Device.DrawString(this._text,_font,Brushes.Red,pt);

          

            

        }


        public override bool Intersects(Envelope envelope)
        {

            return envelope.Contains(this._postion);
          

        }




    }
}
